home *** CD-ROM | disk | FTP | other *** search
- *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
- * Name > StripCom 1.0
- *
- * Synopsis > This sub routine will remove comments in a ascii text
- *
- * Function > library sub routine
- *
- * Inputs > a0 - pointer to text buffer
- * a1 - pointer to destination buffer
- * Result > stripped buffer
- *
- * Notes > used to interpertate ascii command language
- * PUBLIC DOMAIN WITH THE DFUNC ARCHIVE!!
- * Bugs >
- *
- * Created > 30.9.95
- * Last change > 30.9.95
- *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
-
- *## For the Startup.asm:
-
- StartSkip = 0 ;0=WB/CLI, 1=CLI only (AsmOne)
- Processor = 0 ;0/680x0
- MathProc = 0 ;0/68881/68882/68040
-
- *## Default includes:
-
- Incdir
-
- Include lvo:Exec.lvo
- Include lvo:Dos.lvo
- Include lvo:Intuition.lvo
- Include lvo:Graphics.lvo
- Include lvo:DFunc.lvo
-
- Incdir inc:
-
- Include Digital.macs
- Include Digital.i
- Include DFunc/DFunc.i
-
- Include Startup.asm
-
- Incdir
-
- dc.b "$VER: StripCom 1.0 (1.10.95)",0
-
- even
- *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
- Init DefLib dfunc,37
- DefEnd
-
- Start NextArg
- beq.w About
-
- move.l d0,a0
- cmp.b #'?',(a0)
- beq.w About
-
- lea IBuff(pc),a1
- .copyI move.b (a0)+,(a1)+
- tst.b -1(a0)
- bne.b .copyI
-
- .nextArg1 NextArg
- beq.b Do
-
- move.l d0,a0
- tst.b 1(a0)
- beq.b .Arg1
-
- st OutFile
-
- move.l d0,a0
- lea OBuff(pc),a1
- .copyO move.b (a0)+,(a1)+
- tst.b -1(a0)
- bne.b .copyO
-
- .nextArg2 NextArg
- beq.b Do
-
- move.l d0,a0
-
- .Arg1 cmp.b #'0',(a0)
- bne.b .arg2
- moveq #0,d0
- bra.b Do
-
- .Arg2 cmp.b #'1',(a0)
- bne.b .arg3
- moveq #1,d0
- bra.b Do
-
- .Arg3 cmp.b #'2',(a0)
- bne.b .arg4
- moveq #2,d0
- bra.b Do
-
- .Arg4 cmp.b #'3',(a0)
- bne.b .Arg5
- moveq #3,d0
- bra.b Do
-
- .Arg5 moveq #0,d0
-
- Do move.l d0,Mode
-
- LibBase dfunc
-
- lea IBuff(pc),a0
- DCall LoadFile
- move.l d1,Length
- move.l d0,File
- beq.b Error1
-
- move.l $4.w,a6
- move.l d1,d0
- move.l #$10001,d1
- Call AllocMem
-
- LibBase dfunc
-
- move.l d0,MPtr
- beq.b Error2
-
- move.l File(pc),a0
- move.l MPtr(pc),a1
- move.l Mode(pc),d0
- DCall StripText
- move.l d0,NLength
-
- lea IBuff(pc),a0
-
- tst.b OutFile
- beq.b .saveSame
-
- lea OBuff(pc),a0
-
- .saveSame move.l MPtr(pc),a1
- move.l NLength(pc),d0
- DCall SaveBuffer
- tst.l d0
- beq.b Error3
-
- *·············································································*
- Close move.l File(pc),d0
- beq.b .noFile
- move.l d0,a0
- DCall RemFile
-
- .noFile move.l $4.w,a6
- move.l MPtr(pc),d0
- beq.b .noMem
- move.l d0,a1
- move.l Length(pc),d0
- Call FreeMem
-
- .noMem Return 0
- *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
- Error1 lea Err1(pc),a0
- DCall WriteStd
- bra.b Close
- *·············································································*
- Error2 lea Err2(pc),a0
- DCall WriteStd
- bra.b Close
- *·············································································*
- Error3 lea Err3(pc),a0
- DCall WriteStd
- bra.b Close
- *·············································································*
- About LibBase dfunc
- lea ATxt(pc),a0
- DCall WriteStd
- bra.b Close
- *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
- IBuff dcb.b 108,0
- OBuff dcb.b 108,0
- Length dc.l 0
- NLength dc.l 0
- Mode dc.l 0
- File dc.l 0
- MPtr dc.l 0
- Err1 dc.b "Error: Can't open infile!",10,0
- Err2 dc.b "Error: Can't allocate memory!",10,0
- Err3 dc.b "Error: Can't open outfile!",10,0
- Atxt incbin data:text/StripCom.txt
- OutFile dc.b 0
- *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
-